package main

import (
	"fmt"
	"runtime"

	"time"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	c := make(chan int, 11)

	for i := 1; i < 1000000; i++ {
		//time.Sleep(1 * time.Second)
		go test(i, c)
	}

	for i := 1; i < 10; i++ {

		temp := <-c
		if 3 == temp {
			//time.Sleep(3 * time.Second)
		}
		//time.Sleep(3 * time.Second)
		fmt.Println(temp)
	}

	//fmt.Println("ee")
}

func test(i int, c chan int) {

	time.Sleep(10 * time.Second)
	fmt.Println("传入的是：", i)
	c <- i

}
